# This file is part of BlackArch Linux ( https://www.blackarch.org/ ).
# See COPYING for license details.

pkgname=quickscope
_pkgname=qu1cksc0pe
pkgver=533.7c12231
pkgrel=1
pkgdesc='Statically analyze windows, linux, osx, executables and also APK files.'
groups=('blackarch' 'blackarch-binary' 'blackarch-reversing')
arch=('any')
url='https://github.com/CYB3RMX/Qu1cksc0pe'
license=('GPL-3.0-or-later')
depends=('python')
makedepends=('git' 'python-setuptools' 'python-pip')
source=("git+https://github.com/CYB3RMX/$_pkgname.git")
sha512sums=('SKIP')
install="$pkgname.install"

pkgver() {
  cd $_pkgname

  ( set -o pipefail
    git describe --long --tags --abbrev=7 2>/dev/null |
      sed 's/\([^-]*-g\)/r\1/;s/-/./g' ||
    printf "%s.%s" "$(git rev-list --count HEAD)" \
      "$(git rev-parse --short=7 HEAD)"
  )
}

package() {
  cd $_pkgname

  install -dm 755 "$pkgdir/usr/bin"
  install -dm 755 "$pkgdir/usr/share/$pkgname"

  install -Dm 644 -t "$pkgdir/usr/share/doc/$pkgname" *.md

  rm LICENSE *.md

  cp -a * "$pkgdir/usr/share/$pkgname"

  cat > "$pkgdir/usr/bin/$pkgname" << EOF
#!/bin/sh
source /usr/share/$pkgname/venv/bin/activate
exec python /usr/share/$pkgname/qu1cksc0pe.py "\$@"
EOF

  chmod +x "$pkgdir/usr/bin/$pkgname"
}

